import Taro, { Component } from '@tarojs/taro'
import { objectToString } from './utils'

export default class AtComponent extends Component {
  static options = {
    addGlobalClass: true
  }

  /**
   * 合并 style
   * @param {Object|String} style1
   * @param {Object|String} style2
   * @returns {String}
   */
  mergeStyle (style1, style2) {
    if (
      ((style1 && typeof style1 === 'object') || !style1) &&
      ((style2 && typeof style2 === 'object') || !style2)
    ) {
      return Object.assign({}, style1, style2)
    }
    return objectToString(style1) + objectToString(style2)
  }
}
